﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_MailExtMailAdd]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_MailExtMailAdd];
GO
CREATE PROCEDURE [dbo].[sproc_MailExtMailAdd]
    (@MailID     [nvarchar](50),
     @Username     [nvarchar](20),
     @Email     [nvarchar](128),
     @ReadFlag     [bit],
     @FolderID     [int],
     @HeadersText     [text],
     @Subject     [nvarchar](200),
     @TextContent     [text],
     @HtmlContent     [text],
     @FromName     [nvarchar](50),
     @FromEmail     [nvarchar](128),
     @CcTo     [nvarchar](200),
     @BccTo     [nvarchar](200),
     @Replyto     [nvarchar](100),
     @SendDate     [datetime],
     @BodySize     [nvarchar](50),
     @Size     [int])

AS 
SET NOCOUNT ON
--判断是否已经接收过了
--IF NOT EXISTS (SELECT 1 FROM TabExtMailList WHERE MailID =@MailID )
--BEGIN
    INSERT INTO [UDS].[dbo].[TabExtMailList] 
         ( [MailID],
            [Username],
           [Email],
           [ReadFlag],
            [FolderID],    
           [HeadersText],
            [Subject],
           [TextContent],
                    [HtmlContent],
          [FromName],
          [FromEmail],
          [CcTo],
          [BccTo],
          [Replyto],
           [SendDate],
           [BodySize],
           [Size]) 
 
VALUES 
    ( @MailID,
     @Username,
     @Email,
     @ReadFlag,
     @FolderID,
     @HeadersText,
     @Subject,
     @TextContent,
     @HtmlContent,
     @FromName,
     @FromEmail,
     @CcTo,
     @BccTo,
     @Replyto,
     @SendDate,
     @BodySize,
     @Size)
--END

SET NOCOUNT OFF